# -*- coding: UTF-8 -*-

import  requests,json,urllib3
requests.packages.urllib3.disable_warnings()

def login():
    parm = {"account": "15507553617", "password": "123456", "fromType": "pc"}
    url = "https://testpassport.rabbitpre.com/api/sso/login"
    p = requests.session()
    resu = p.post(url, json=parm,verify=False)
    if resu.json().get("errorCode") == "SUCCESS":
        print("登录成功")
    else:
        print("登录失败")

    url2="https://bws.test.rabbitpre.com"
    # tre=p.get("https://bws.test.rabbitpre.com",verify=False)
    url3="https://home.test.rabbitpre.com/api/workbench/org/getCompanyInfo"
    top=p.get(url3,verify=False)
    if top.json()["success"] == "true":
        userid=top.json()["data"]["org_user"]
        orgid=top.json()["data"]["org_user"]
        print("{}{}".format(userid,orgid))
    else:
        print("登录已失效")

    print(top.text)


if __name__ == '__main__':
    login()